const app = {
  state: {
    level: 0
  },
  mutations: {
    ADD_LEVEL: (state, num) => {
      state.level += num
    },
    delLev (state, num) {
      if (state.level > 0) {
        state.level -= num
      } else {
        state.level = 0
      }
    }
  },
  actions: {
    getAddCount ({ commit }, num) {
      return commit('ADD_LEVEL', num)
    },
    getDelCount (context, num) {
      context.commit('delLev', num)
    }
  }
}

export default app
